package com.kinghunt.misp.common.enums.userx;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
 * 用户状态枚举
 *
 * @author jiangtao
 * @date 2020-01-30 20:59.
 */
public enum UserStatusEnum {
    /**
     * 激活状态
     */
    ACTIVE(1, "激活");

    @Getter
    private Integer value;
    @Getter
    private String desc;

    UserStatusEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    private final static Map<Integer, UserStatusEnum> map = new HashMap<>(8);
    static {
        for (UserStatusEnum e : UserStatusEnum.values()) {
            map.put(e.getValue(), e);
        }
    }

    public static UserStatusEnum getByType(Integer value) {
        if (Objects.isNull(value)) {
            return null;
        }
        return map.get(value);
    }
}
